package com.iespring.controller.app.collect;

import com.iespring.bean.app.collect.bo.AddOrDeleteBo;
import com.iespring.bean.common.BasePageInfo;
import com.iespring.bean.common.BaseRespVo;
import com.iespring.bean.common.CommonData;
import com.iespring.service.app.collect.WxCollectService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @author KeFei
 * @description: 小程序收藏模块
 * @date 2023/1/1 23:56
 */
@RestController
@RequestMapping("wx")
public class CollectController {

    @Resource
    WxCollectService collectService;

    /**
     * 显示收藏商品列表
     */
    @RequestMapping("collect/list")
    public BaseRespVo getCollectList(BasePageInfo basePageInfo){

        CommonData data = collectService.getCollectList(basePageInfo);

        return BaseRespVo.ok(data);
    }

    /**
     * 收藏或取消收藏商品
     */
    @RequestMapping("collect/addordelete")
    public BaseRespVo addOrDelete(@RequestBody AddOrDeleteBo addOrDeleteBo){

        collectService.addOrDelete(addOrDeleteBo);

        return BaseRespVo.ok();
    }

}
